Hi,

I have a loading bar gif to be displayed initially, until main image (1MB) is loaded in my web page. How can i do it?

Thanks

Recommended Answers

All 2 Replies

just add a function to the onload method of the document this will fire when the page has finished loading all external content. You can use this then to hide your gif after the page is done.

<html>
    <head>
    <script language="javascript" type="text/javascript">
        function hideLoading() {
            document.getElementById('loadingMessage').style.display = 'none';
        }
    </script>
    </head>
    <body onload="hideLoading();">
        <div id="loadingMessage">
            <img src="loading_image.gif" />
        </div>
        <img src="your_massive_image.jpg" />
    </body>
</html>

I'll try this and let you know. Thanks for now.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.